package com.mlnx.netty.handler;



import com.mlnx.bptp.BpPacket;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

public class BpEncode extends MessageToByteEncoder<BpPacket> {

	public void encode(ChannelHandlerContext arg0, BpPacket arg1, ByteBuf arg2)
			throws Exception {

		try {
			byte[] bs = arg1.encode();
			arg2.writeBytes(bs);

		}catch (Exception e){
			e.printStackTrace();
		}

	}
}
